<?php

/**
 * mesdossiers filter form base class.
 *
 * @package    e-DSL
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasemesdossiersFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'datedossier'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'type_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('type'), 'add_empty' => true)),
      'categorie_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'), 'add_empty' => true)),
      'name_client'       => new sfWidgetFormFilterInput(),
      'name_demandeur'    => new sfWidgetFormFilterInput(),
      'datereference'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'dateAction'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'state'             => new sfWidgetFormFilterInput(),
      'brouillon'         => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'urgent'            => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'ferme'             => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'fermeTechnique'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'etat_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('etatdossier'), 'add_empty' => true)),
      'client_id'         => new sfWidgetFormFilterInput(),
      'demandeur_id'      => new sfWidgetFormFilterInput(),
      'acteur_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('acteur'), 'add_empty' => true)),
      'enAttente'         => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'raisonAttente'     => new sfWidgetFormFilterInput(),
      'persacteur_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('persacteur'), 'add_empty' => true)),
      'acteurpersonne_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('lienacteurpersonne'), 'add_empty' => true)),
      'lienetat_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('lienetat'), 'add_empty' => true)),
      'readOnly'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'departement_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('departement'), 'add_empty' => true)),
      'region_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('region'), 'add_empty' => true)),
      'created_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'datedossier'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'type_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('type'), 'column' => 'id')),
      'categorie_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('categorie'), 'column' => 'id')),
      'name_client'       => new sfValidatorPass(array('required' => false)),
      'name_demandeur'    => new sfValidatorPass(array('required' => false)),
      'datereference'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'dateAction'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'state'             => new sfValidatorPass(array('required' => false)),
      'brouillon'         => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'urgent'            => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'ferme'             => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'fermeTechnique'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'etat_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('etatdossier'), 'column' => 'id')),
      'client_id'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'demandeur_id'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'acteur_id'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('acteur'), 'column' => 'id')),
      'enAttente'         => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'raisonAttente'     => new sfValidatorPass(array('required' => false)),
      'persacteur_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('persacteur'), 'column' => 'id')),
      'acteurpersonne_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('lienacteurpersonne'), 'column' => 'id')),
      'lienetat_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('lienetat'), 'column' => 'id')),
      'readOnly'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'departement_id'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('departement'), 'column' => 'id')),
      'region_id'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('region'), 'column' => 'id')),
      'created_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('mesdossiers_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'mesdossiers';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'datedossier'       => 'Date',
      'type_id'           => 'ForeignKey',
      'categorie_id'      => 'ForeignKey',
      'name_client'       => 'Text',
      'name_demandeur'    => 'Text',
      'datereference'     => 'Date',
      'dateAction'        => 'Date',
      'state'             => 'Text',
      'brouillon'         => 'Boolean',
      'urgent'            => 'Boolean',
      'ferme'             => 'Boolean',
      'fermeTechnique'    => 'Boolean',
      'etat_id'           => 'ForeignKey',
      'client_id'         => 'Number',
      'demandeur_id'      => 'Number',
      'acteur_id'         => 'ForeignKey',
      'enAttente'         => 'Boolean',
      'raisonAttente'     => 'Text',
      'persacteur_id'     => 'ForeignKey',
      'acteurpersonne_id' => 'ForeignKey',
      'lienetat_id'       => 'ForeignKey',
      'readOnly'          => 'Boolean',
      'departement_id'    => 'ForeignKey',
      'region_id'         => 'ForeignKey',
      'created_at'        => 'Date',
      'updated_at'        => 'Date',
    );
  }
}
